<template>
  <van-action-sheet
  v-model="isShow"
  :actions="actions"
  description="配送至"
  close-on-click-action
  safe-area-inset-bottom
  @click-overlay='clickHandler'
  @click="clickHandler"
  @select='selectHandler'
/>
</template>

<script>
import Vue from 'vue';
import { ActionSheet } from 'vant';
import { mapActions } from 'vuex'
Vue.use(ActionSheet);
export default {
  data() {
    return {
      actions: [
        { name: '选项一' },
        { name: '选项二' },
        { name: '选择其他地址' },
      ],
    };
  },
  methods: {
    ...mapActions(['addressShow']),
    clickHandler() {
      this.addressShow(false)
    },
    selectHandler(action) {
      console.log(action.name)
      if(action.name === '选择其他地址') {
        this.$router.push({path:'/NewAddress'})
      }
      this.addressShow(false)
    }
  },
  computed: {
    isShow: {
      get: function() {
          return this.$store.state.isAddressShow
      },
      set: function() {
      }
    }
  }
}
</script>
<style lang="stylus" scoped>

</style>